<?php
class ProductTypeValidate extends Validate{
	protected function valid(){
		$result = array();
		if(empty($this->param['prodTypeName'])){
			$result['result'] = 'error';
			$result['error'] = '分类名称不能为空';
			return $result;
		}
		if(empty($this->param['prodTypeIsHot'])){
			$this->param['prodTypeIsHot'] = 0;//设为非热门行业
		}
		if(empty($this->param['prodTypeParentId'])){
			$this->param['prodTypeParentId'] = 0;//设为顶级父类
		}
		if(empty($this->param['prodTypeCategory'])){
			$this->param['prodTypeCategory'] = 1; //设为产品类
		}
		if(empty($this->param['prodTypeOrder'])){
			$this->param['prodTypeOrder'] = 0; //排序号设为0
		}
		if(isset($this->param['prodTypeOrder'])){
			if(!preg_match("/^\d+$/",$this->param['prodTypeOrder'])
			|| $this->param['prodTypeOrder'] >99999){
				$result['result'] = 'error';
				$result['error'] = '排序号只能为小于99999的正整数';
				return $result;
			}
		}
		$result['result'] = 'success';
		return $result;
	}
}
?>